import java.util.Scanner;

/**
 * 【程序8】   
 * 题目：求s=a+aa+aaa+aaaa+aa...a的值，
 * 其中a是一个数字。例如2+22+222+2222+22222(此时共有5个数相加)，几个数相加由键盘控制。  
 */
public class test8 {
    public static void main(String[] args) {
        Scanner sc1 = new Scanner(System.in);
        Scanner sc2 = new Scanner(System.in);
        System.out.print("请输入一位0~9的数字：");
        int a = sc1.nextInt();
        System.out.print("请输入加数个数：");
        int num = sc2.nextInt();
        int add = 0;
        int sum = 0;
        for (int i = 0; i < num; i++) {
            add = add + (int) (a * Math.pow(10, i));
            sum = sum + add;
            if (i == num - 1) {
                System.out.print(add + "=" + sum);
                break;
            }
            System.out.print(add + "+");
        }
    }
}
